package day_09;

import java.util.Scanner;

public class CarTest {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        //创建数组
        Car[] arr=new Car[3];
        //创建对象,数据来自键盘录入
        for (int i = 0; i < arr.length; i++) {
            //创建对象
            Car c=new Car();
            //录入信息
            System.out.println("输入汽车品牌");
            String name = sc.next();
            c.setName(name);
            System.out.println("输入汽车价格");
            double price = sc.nextDouble();
            c.setPrice(price);
            System.out.println("输入汽车应颜色");
            String colour = sc.next();
            c.setColour(colour);
            //把汽车对象录hh入到数组中去
            arr[i]=c;
        }
        //遍历数组
        for (int i = 0; i < arr.length; i++) {
            System.out.println(arr[i].getName()+','+arr[i].getPrice()+','+arr[i].getColour());
        }

    }
}
